/*
package algorithm.practice;

import java.util.Scanner;

*/
/**
 * <ul>
 * <li>Title: TreeUtil</li>
 * <li>Description: TODO </li>
 * </ul>
 *
 * @author swc
 * @date 2021-08-25 17:15
 *//*

public class TreeUtil {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入节点数量 和 根节点的值 以空格隔开");
        String firstV = scanner.nextLine();
        String[] split = firstV.split(" ");
        //节点数量
        int nodeCount = Integer.parseInt(split[0]);

        Scanner sc = new Scanner(System.in);
        sc.nextLine(); // 第一行没啥用


        TreeNode rootTreeNode = createTreeNode(sc);

   */
/*     for (int i = 0; i < nodeCount; i++) {

        }*//*



        System.out.println("-----");




        //TreeNode treeNode =new TreeNode(0);
        
        

    }

    private static TreeNode createTreeNode(String inputStr, String[] inputArr, Scanner scanner) {

        System.out.println("请输入当前节点的三个值(空格隔开)");
        inputStr= scanner.nextLine();
        inputArr = inputStr.split(" ");

        int parentV  = Integer.parseInt(inputArr[0]);

        int leftV  = Integer.parseInt(inputArr[1]);

        int rightV =  Integer.parseInt(inputArr[2]);

        TreeNode root =new TreeNode(parentV);
        if (leftV != 0) {
            root.setLeft(createTreeNode(inputStr,inputArr,scanner));
        }
        if (rightV != 0) {
            root.setRight(createTreeNode(inputStr,inputArr,scanner));
        }
        return root;
    }

    // 构造二叉树
    private static TreeNode createTree(Scanner sc) {
        String[] values = sc.nextLine().split(" ");
        if (values.length < 3) {
            return null;
        }

        int value = Integer.parseInt(values[0]);
        int left = Integer.parseInt(values[1]);
        int right = Integer.parseInt(values[2]);

        TreeNode root = new TreeNode(value);
        if (left != 0) {
            root.setLeft(createTree(sc));
        }
        if (right != 0) {
            root.setLeft(createTree(sc));
        }

        return root;
    }


}
*/
